package com.simple.utils;

import java.util.Random;
import java.util.UUID;

public class RandomUtils {
	
	 /**
     * 获取得到4位的随机数
     *
     * @return
     */
    public static String getFourRandom() {
        Random random = new Random();
        String fourRandom = random.nextInt(10000) + "";
        int randLength = fourRandom.length();
        if (randLength < 4) {
            for (int i = 1; i <= 4 - randLength; i++)
                fourRandom = "0" + fourRandom;
        }
        return fourRandom;
    }
    
    public static String getId() {
    	return UUID.randomUUID().toString().replaceAll("-", "");
    }
    
    
    public static void main(String[] args) {
		System.out.println(getId());//格式 b4428171a4b94461b4fe2abb726b2abe
	}
	
    
    

}
